package com.Apo1o.mpGenerator;

import com.baomidou.mybatisplus.generator.AutoGenerator;
import com.baomidou.mybatisplus.generator.config.DataSourceConfig;

/**
 * @Auther: Apo1o.
 * @Date: 2023/11/14-11-14-22:17
 * @Description： com.Apo1o.mpGenerator
 */
public class Generator {

        public static void main(String[] args) {
//1. 创建代码生成器对象，执行生成代码操作
            AutoGenerator autoGenerator = new AutoGenerator();
//2. 数据源相关配置：读取数据库中的信息，根据数据库表结构生成代码
            DataSourceConfig dataSource = new DataSourceConfig();
            dataSource.setDriverName("com.mysql.cj.jdbc.Driver");
            dataSource.setUrl("jdbc:mysql://localhost:3306/cms? serverTimezone=UTC");
                    dataSource.setUsername("cms");
            dataSource.setPassword("cms");
            autoGenerator.setDataSource(dataSource);
//3. 执行生成操作
            autoGenerator.execute();
        }

}
